import { PLUGIN_BOLD } from './options.js'
import Plugin from './plugin.js'
export default class BoldPlugin extends Plugin {
    constructor(name, editor) {
        super(name, editor)
        this._config = PLUGIN_BOLD
        this._bold = false
        this._init()
    }

    getDom() {
        return this._plugin
    }

    _init() {
        this._createForm()
    }

    _createForm() {
        this._plugin = document.createElement('li')
        this._plugin.classList.add('plugin-trigger')
        this._plugin.innerHTML = this._config.content
        this._plugin.title = this._config.name
        this._plugin.addEventListener('mousedown', (e) => {
            e.preventDefault()
            this._execCommand()
        })
    }

    _execCommand() {
        this._command.setBold(this._bold)
    }
}